package com.trace.controller.report;


import cn.hutool.core.io.FileUtil;
import com.trace.controller.report.rep.APIResult;
import com.trace.entity.TUser;
import com.trace.mapper.TReportMapper;
import com.trace.mapper.TUserMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;


@RestController
@Slf4j
public class TestController {
    @Resource
    TUserMapper userMapper;
    @Resource
    TReportMapper reportMapper;

    @GetMapping("/test")
    public APIResult test() {
        byte[] bytes = FileUtil.readBytes(new File("D:\\Code\\Java-Code\\rc-trace-service\\rc-upload\\pic\\2025-03-05\\2760025349.jpg"));
//        TUser tUser = new TUser();
//        tUser.setUserName("Anis");
//        tUser.setUserId(5);
//        tUser.setPassWord("111111");
//        tUser.setDeptId(1);
//        tUser.setAvatar(bytes);
//        userMapper.insert(tUser);
        TUser tUser = userMapper.selectById(1);
        tUser.setAvatar(bytes);
        userMapper.updateById(tUser);
        return APIResult.ok();
    }
}
